package game;

import java.util.Random;

import Public.ServerMoney;
import util.CommonUtil;

public class JackPotGold extends JackPot {

	public JackPotGold(String xmlUrl) {
		super(xmlUrl);
		ran = new Random(CommonUtil.currentMillis());
		
	}
	


	/**
	 * GM奖金
	 * 
	 * @return
	 */
	public void AddGMPoolBlood(int mNum) {
		numGMPoolBlood += mNum;
		ServerMoney.Out(mNum, 0);
	}

	/**
	 * 开奖
	 */
	
	public int TheLottery(int mNumBlood, int mTimes) {
		numPoolBlood += mNumBlood;
		if (getPoolBlood() < 2000) {
			return 0;
		} else {
			int numRan = 0;
			int numTemp = 0;
			for (int i = 0; i < mTimes; i++) {
				numRan = ran.nextInt(lotteryOdds);
				numTemp = ran.nextInt(lotteryOdds);
				if (numRan == numTemp) {
					int getNum = getPoolBlood();
					int serverGet = numGMPoolBlood + numPoolBlood - getNum;
					ServerMoney.In(serverGet, 0,0);
					numPoolBlood = 0;
					numGMPoolBlood = 0;

					return getNum;
				}
			}
			return 0;
		}
	}
}